|
![](/i/fill.gif) |
Geoff Wedig <wed### [at] darwin epbi cwru edu> wrote:
: So, instead of generating 3 numbers, generate 2, latitude and longitude.
: Ie:
: #declare c1 = 180 * rand(s1) - 90;
: #declare c2 = 360 * rand(s1);
: translate <0,0,1000> // Assuming object originally at origin.
: rotate <0, c2, c1> // This means y is up direction, but it is really
: // irrelevant which rotation is first and which
: // of the axes as used as long as the first axis is
: // not the direction of translation.
This is exactly the mistake made in the original code.
That doesn't distribute the points evenly. There will be more spheres
near the z-axis than elsewhere.
You can test that if you like. Create LOTS of spheres with that algorithm.
You'll notice how they will concentrate near the z-axis.
The idea behind my algorithm is that the spheres are truely distributed
evenly around the sphere.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |